Ext.onReady(function() {
	
	var form = Ext.create('Ext.form.FormPanel',{
		id:'form',
		title:'upload-form',
		renderTo:Ext.getBody(),
		autoHeight:true,
		autoWidth:true,
		frame:true,
		defaults:{
			allowBlank:false,
			msgTarget : 'side'
		},
		items:[{
			xtype:'filefield',
			name:'file',
			fileLabel:'file',
			anchor:'100%',
			buttonText:'browse'
		}],//end of items
		buttons:[{
			text:'upload',
			handler:uploadFn
		}]//end of buttons
	});//end of form
	
	function uploadFn() {
		var getForm = Ext.getCmp('form').getForm();
		if(getForm.isValid()){
			getForm.submit({
				//url:'fileUploadAction.do?method=upload',
				url:'fileUploadAction!upload',
				waitMsg:'uploading... ...',
				success:function(form,action) {
					Ext.Msg.alert('','upload success!');
				},
				failure:function(form,action) {
//					Ext.Msg.alert('','upload failure!'+action.result.errorMsg);
				    Ext.Msg.alert('upload fail',action.result.errors);
				}
			});//end of submit
		}//end of if
		
	}

});//end of Ext.onReady